package cn.dlc.com.account.controller;

import cn.dlc.com.account.service.AccountService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 邓立川
 * @date 2021/1/19 10:02
 * @desc 添加当前类的描述信息
 */
@RestController
@RequestMapping("tcc1")
public class AccountController {

    @Autowired
    private AccountService accountService;

    @PostMapping("transfer")
    private String transfer(String accountNo, Double amount){
        try {
            if(StringUtils.isNotBlank(accountNo) && amount != null) {
                accountService.updateAccount(accountNo,amount);
            }

            return "ok";
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
    }
}
